﻿
namespace NPack.Interfaces
{
    /// <summary>
    /// Every class that defines a * operation 
    /// like <c>TProduct operator * (IMultipliable`2 a, TFactor b)</c> should consider
    /// implementing this interface.
    /// </summary>
    /// <typeparam name="TFactor">
    /// Type which multiplies the <see cref="IMultipliable{TFactor, TProduct}"/> instance.
    /// </typeparam>
    /// <typeparam name="TProduct">Result type of the multiplication operation.</typeparam>
    /// <remarks>
    /// Adapted from an article on lambda-computing.com: 
    /// http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs.
    /// </remarks>
    public interface IMultipliable<TFactor, TProduct>
    {
        /// <summary>
        /// Returns the product of the Object and <paramref name="b"/>.
        /// It must not modify the value of the Object.
        /// </summary>
        /// <param name="b">The factor to multiply by.</param>
        /// <returns>The product.</returns>
        TProduct Multiply(TFactor b);
    }
}
